package com.canbot.u05.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.canbot.u05.R;

/**
 * 通用提示弹框
 */

public class CenterCommonHintDialog extends Dialog implements View.OnClickListener {

        private int firstHint = 3;

        private int SecondHint = 4;

        public CenterCommonHintDialog(Context context, int id) {
                super(context, R.style.MyDialogStyle);
                setmenuDialog(id);
        }

        private void setmenuDialog(int id) {
                switch (id) {
                        case 3:
                                View viewdel = LayoutInflater.from(getContext()).inflate(R.layout.counsel_dialog_cell, null);
                                super.setContentView(viewdel);
                                Button btn_cal = (Button) viewdel.findViewById(R.id.counsel_dialog_cancel);
                                Button btn_reconnection = (Button) viewdel.findViewById(R.id.counsel_dialog_reconnection);
                                btn_cal.setOnClickListener(this);
                                btn_reconnection.setOnClickListener(this);
                                break;
                        case 4:
                                View viewname = LayoutInflater.from(getContext()).inflate(R.layout.dialog_hint, null);
                                super.setContentView(viewname);
                                Button btn_hint_cal = (Button) viewname.findViewById(R.id.counsel_dialog_cancel);
                                Button btn_hint_reconnection = (Button) viewname.findViewById(R.id.dialog_hint_reconnection);
                                btn_hint_cal.setOnClickListener(this);
                                btn_hint_reconnection.setOnClickListener(this);
                                break;
                        case 8:
                                View view2 = LayoutInflater.from(getContext()).inflate(R.layout.dialog_hint2, null);
                                super.setContentView(view2);
                                Button btn_hint2_cancel = (Button) view2.findViewById(R.id.dialog_hint2_cancel);
                                Button btn_hint2_reconnection = (Button) view2.findViewById(R.id.dialog_hint2_reconnection);
                                btn_hint2_cancel.setOnClickListener(this);
                                btn_hint2_reconnection.setOnClickListener(this);
                                break;

                        case 9:
                                View viewVerify = LayoutInflater.from(getContext()).inflate(R.layout.dialog_verify_failed, null);
                                super.setContentView(viewVerify);
                                Button btn_verify_disconnect = (Button) viewVerify.findViewById(R.id.dialog_verify_failed_disconnect);
                                Button btn_verify_reconnect = (Button) viewVerify.findViewById(R.id.dialog_verify_failed_reconnect);
                                btn_verify_disconnect.setOnClickListener(this);
                                btn_verify_reconnect.setOnClickListener(this);
                                break;

                        case 10:
                                View factory = LayoutInflater.from(getContext()).inflate(R.layout.dialog_factory_reset, null);
                                super.setContentView(factory);
                                factory.findViewById(R.id.reset_dialog_sure).setOnClickListener(this);
                                factory.findViewById(R.id.reset_dialog_cancel).setOnClickListener(this);
                                break;

                }


        }

        CenterCommonHintOnlickListner centerCommonHintOnlickListner;

        public interface CenterCommonHintOnlickListner {

                void onClick(int id);
        }

        public void setListner(CenterCommonHintOnlickListner listner) {
                this.centerCommonHintOnlickListner = listner;
        }

        @Override
        public void onClick(View view) {
                if (centerCommonHintOnlickListner != null) {
                        centerCommonHintOnlickListner.onClick(view.getId());
                }
        }
}
